﻿
namespace SdmxMl.Structure
{
    public enum RepresentationSchemeTypeType
    {
        Codelist,
        Concept,
        Category,
        Organisation,
        External,
    }

    public class RepresentationSchemeType21Helper
    {
        public static RepresentationSchemeTypeType GetRepresentationFor20(
            ItemSchemePackageTypeCodelistType package)
        {
            RepresentationSchemeTypeType rep = RepresentationSchemeTypeType.External;

            // Supported packages
            if (package == ItemSchemePackageTypeCodelistType.categoryscheme)
                rep = RepresentationSchemeTypeType.Category;
            else if (package == ItemSchemePackageTypeCodelistType.codelist)
                rep = RepresentationSchemeTypeType.Codelist;
            else if (package == ItemSchemePackageTypeCodelistType.conceptscheme)
                rep = RepresentationSchemeTypeType.Concept;

            return rep;

        }

        public static ItemSchemePackageTypeCodelistType GetPackageFor21(RepresentationSchemeTypeType rep)
        {
            ItemSchemePackageTypeCodelistType package = ItemSchemePackageTypeCodelistType.Base;
            if (rep == RepresentationSchemeTypeType.Category)
                package = ItemSchemePackageTypeCodelistType.categoryscheme;
            else if (rep == RepresentationSchemeTypeType.Codelist)
                package = ItemSchemePackageTypeCodelistType.codelist;
            else if (rep == RepresentationSchemeTypeType.Concept)
                package = ItemSchemePackageTypeCodelistType.conceptscheme;

            return package;
        }

        public static ItemSchemeTypeCodelistType GetClassFor21(RepresentationSchemeTypeType rep)
        {
            ItemSchemeTypeCodelistType itemClass = ItemSchemeTypeCodelistType.DataProviderScheme;
            if (rep == RepresentationSchemeTypeType.Category)
                itemClass = ItemSchemeTypeCodelistType.CategoryScheme;
            else if (rep == RepresentationSchemeTypeType.Codelist)
                itemClass = ItemSchemeTypeCodelistType.Codelist;
            else if (rep == RepresentationSchemeTypeType.Concept)
                itemClass = ItemSchemeTypeCodelistType.ConceptScheme;

            return itemClass;
        }
    }
}
